import request from '@/axios'
import { CompanyParams, CompanyResponse } from './types'

export const getCompanyApi = (params: CompanyParams) => {
  return request.get<CompanyResponse>({ url: '/company/list', params })
}

export const deleteCompanyByIdApi = (ids: string[] | number[]) => {
  return request.delete({ url: '/company/delete', data: { ids } })
}

export const saveCompanyApi = (data: any) => {
  return request[data.id ? 'put' : 'post']({
    url: data.id ? '/company/edit' : '/company/add',
    data
  })
}
